<%-- 
    Document   : categoryManagement
    Created on : Feb 16, 2012, 10:50:40 PM
    Author     : quy
--%>

<%@ taglib prefix="sql" uri="http://java.sun.com/jsp/jstl/sql" %>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<jsp:include page="header.jsp" />      
    <div id="inner_wrap">
	<div id="inner_hold">
	<div id="inner">
	<div class="center_hold">
        <jsp:useBean id="category" class="com.aal.model.CategoryManagement">
            <c:set target="${category}" property="categoryName" value="${param.name}"/>
            <c:set target="${category}" property="categoryDescription" value="${param.description}"/>
            <c:set target="${category}" property="hidden" value="${param.hidden}"/>
        </jsp:useBean>    
            <c:if test="${!empty param.name && param.hidden =='create'}">
                <jsp:getProperty name="category" property="createCategory"/>           
            </c:if>
            <c:if test="${!empty param.name && param.hidden =='edit'}">
                <jsp:getProperty name="category" property="editCategory"/>
            </c:if>
            <c:if test="${!empty param.name && param.hidden =='delete'}">
                <jsp:getProperty name="category" property="deleteCategory"/>
            </c:if>
            
        
        <form>
            <fieldset>
                <legend>category management</legend>
                <input type="hidden" name="hidden" value="create"/>
                <label for="categoryname">category name</label>
                <input type="text" name="name" required/></br>
                <label for="categorydescription">category description</label>
                <input type="text" name="description" required/></br>
                <input type="submit" value="createcategory" name="createCategory"/></br>               
            </fieldset>
        </form>
        <hr/>
        <form>
            <fieldset>
                <legend>category management</legend>
                <input type="hidden" name="hidden" value="edit"/>
                <label for="categoryname">category name</label>
                <input type="text" name="name" required/></br>
                <label for="categorydescription">category description</label>
                <input type="text" name="description" required/></br>
                <input type="submit" value="editcategory" name="editCategory"/></br>
            </fieldset>
        </form>
        <form>
            <fieldset>
                <legend>category management</legend>
                <input type="hidden" name="hidden" value="delete"/>
                <label for="categoryname">category name</label>
                <input type="text" name="name" required/></br>
                <input type="submit" value="delete category" name="deleteCategory"/></br>
            </fieldset>
        </form>
        <form>
            <fieldset>
                <legend>category management</legend>
                <input type="hidden" name="hidden" value="all"/>
                <label for="categoryname">category name</label>
                <input type="text" name="name"/></br>
                <input type="submit" value="ViewAll"/>
            </fieldset>
        </form>
        <c:if test="${param.hidden=='all'}">
            <table class="bordered">
            <c:forEach items="${category.viewAll}" var="item">
                <tr><td><c:out value="${item.categoryName}"/></td><td><c:out value="${item.categoryDescription}"/></td></tr>
            </c:forEach>
            </table>
        </c:if>
        <form>
            <fieldset>
                <legend>category management</legend>
                <input type="hidden" name="hidden" value="all1"/>
                <label for="categoryname">category name</label>
                <input type="text" name="name" required=""/></br>
                <input type="submit" value="Search Category by Name"/>
            </fieldset>
        </form>
        <c:if test="${!empty param.name && param.hidden=='all1'}">
            <table class="bordered">
                <c:forEach items="${category.searchCategory}" var="item">
                <tr><td><c:out value="${item.categoryName}"/></td><td><c:out value="${item.categoryDescription}"/></td></tr>
            </c:forEach>
            </table>
        </c:if>
    </div>
	</div>
	</div>
	</div>
<jsp:include page="footer.jsp" />